/**
 * @Author       : Hejh(3010733382@qq.com)
 * @Version      : V1.0
 * @Date         : 2024-02-16 09:51:02
 * @Description  : 权限接口控制器
 */

const { Op } = require('sequelize')
const { Permission } = require('@/models/model')
const { listModel } = require('@/utils/controllerCommon')

/**
 * 列表查询通知接口
 * @param {*} ctx
 * @returns
 */
module.exports.listPermission = async (ctx) => {
  const { type } = ctx.query
  const whereCondition = {}

  if (type !== undefined) {
    if (+type === 0) {
      whereCondition.ename = {
        [Op.notLike]: 'doc%'
      }
    } else if (+type === 1) {
      whereCondition.ename = {
        [Op.like]: 'doc%'
      }
    }
  }
  // if (isVisible) {
  //   whereCondition.isVisible = +isVisible
  // }
  await listModel(Permission)(ctx, whereCondition, [['id']])
}
